package com.whksoft.mymapplugin.API.Event;

import com.whksoft.mymapplugin.utils.CancelReason;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;

/**
 * 取消支付事件
 */
public class PaymentCanceledEvent extends Event {

    private static final HandlerList handlers = new HandlerList();
    private final Player player;
    private boolean cancelled;
    private CancelReason reason = null;

    public PaymentCanceledEvent(Player player, CancelReason reason) {
        this.player = player;
        this.reason = reason;
    }

    public static HandlerList getHandlerList() {
        return handlers;
    }

    @Override
    public HandlerList getHandlers() {
        return handlers;
    }

    /**
     * 获取取消支付的玩家
     * @return 取消支付的玩家对象
     */
    public Player getPlayer(){
        return player;
    }

    public boolean isCancelled() {
        return cancelled;
    }

    /**
     * @return 取消支付的原因
     */
    public CancelReason getReason(){
        return reason;
    }

    public void setCancelled(boolean cancelled) {
        this.cancelled = cancelled;
    }

}
